Enable User Agent feature extension#4124
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the EnableUserAgent AppContext switch and makes the UserAgent TDS feature extension always included when feature extensions are requested, aligning the driver behavior with always-on UserAgent support.
Changes:
- Remove
LocalAppContextSwitches.EnableUserAgentand related test helper plumbing. - Always write the UserAgent feature extension request in
TdsParserwhenrequestedFeaturesincludesUserAgent. - Update simulated server unit tests to stop toggling the removed switch.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs | Removes per-test switch toggling for UserAgent feature extension. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/LocalAppContextSwitchesTest.cs | Drops the default-value assertion for the removed switch. |
| src/Microsoft.Data.SqlClient/tests/Common/LocalAppContextSwitchesHelper.cs | Removes reflection-based support for capturing/restoring the removed switch. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs | Removes the AppContext gate so UserAgent request is written whenever requested. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs | Deletes the EnableUserAgent switch definition, cache field, and accessor. |
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs
Outdated
Show resolved
Hide resolved
|
Is this info avaliable on the Azure SQL side and if so, how? |
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs
Outdated
Show resolved
Hide resolved
@ErikEJ - AFAIK, this information is not visible external to Microsoft at the moment. |
1a1599b to
aebd3bd
Compare
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4124 +/- ##
==========================================
- Coverage 73.22% 66.56% -6.66%
==========================================
Files 280 274 -6
Lines 43000 65796 +22796
==========================================
+ Hits 31486 43797 +12311
- Misses 11514 21999 +10485
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aebd3bd to
cbe5a85
Compare
Removes app context switch no longer needed - feature is to be always-enabled.